package com.oa.xinxi.biz;

import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.oa.xinxi.dao.NewsMapper;
import com.oa.xinxi.dao.WorkPlanMapper;
import com.oa.xinxi.entity.News;
import com.oa.xinxi.entity.WorkPlan;
@Service
public class WorkPlanBiz {
	@Resource
	private WorkPlanMapper workPlanMapper;
	public void save(WorkPlan workPlan) {
		workPlan.setCreatetime(new Date());
		workPlanMapper.insert(workPlan);
	}
	public void deleteById(int id) {
		workPlanMapper.deleteByPrimaryKey(id);
	}
	public void update(WorkPlan workPlan) {
		workPlan.setUpdatetime(new Date());
		WorkPlan workPlan2 = workPlanMapper.selectByPrimaryKey(workPlan.getWpId());
		workPlan.setCreatetime(workPlan2.getCreatetime());
		workPlan.setCreator(workPlan2.getCreator());
		workPlanMapper.updateByPrimaryKeySelective(workPlan);
	}
	public WorkPlan findById(Integer id) {
		return workPlanMapper.selectByPrimaryKey(id);
	}
	public List<WorkPlan> findAll() {
		return workPlanMapper.findAll();
	}
}
